DC.front.win.RenameFileWin = function(params, config) {
	var rfw = this;
	
	var fm = new Ext.form.FormPanel({   
	    autoScroll : true,
	    frame : false, 
	    bodyStyle : 'padding:30px 10px;',
	    autoHeight : true,
	    autoWidth : true,
	    defaultType : 'textfield',  
	    labelWidth : 80,
	    items:[{
	    	xtype : 'hidden',
	        name : 'nodeId',
	        value : params.nodeId
	    }, {
	    	xtype : 'hidden',
	        name : 'depth',
	        value : params.depth
	    }, {
	    	xtype : 'hidden',
	        name : 'filePath',
	        value : params.filePath
	    }, {
	    	id : 'rename_file_win_newName_textfiled',
	    	anchor: "96.7%",
	        fieldLabel : 'New name',   
	        name : 'fileName',
	        value : params.fileName,
	        allowBlank : false,
        	blankText : 'New name cannot be empty.',
        	regex : /^[^\/\\<>\*\?\:"\|]*[^\/\\<>\*\?\:"\|]$/,
            regexText : 'New name is Illegal.',
            enableKeyEvents: true, // 只有将此属性设置成true，此控件的键盘事件才生效
            listeners : {
        		keyup : function() {
        			var created_btn = Ext.getCmp('rename_file_win_rename_btn');
        			if (params.fileName == this.getValue()) {
        				created_btn.disable();
        			} else {
        				if (this.isValid()) {
            				created_btn.enable();
            			} else {
            				created_btn.disable();
            			}
        			}
        		}
        	}
	    }] 
	}); 
	
	DC.front.win.RenameFileWin.superclass.constructor.call(this, Ext.apply({
    	id : 'rename_file_win',
    	title : 'Rename File Win',
    	width : 400,
    	height : 150,
        border : true,
        bodyBorder : true,
        layout : 'fit',
        modal : true,
        closeAction : 'close',
        buttonAlign : 'right',
        items :[fm],
        buttons: [{  
	        text : 'Rename',
	        id : 'rename_file_win_rename_btn',
	        disabled : true,
	        handler : function(){  
	            rfw.doRename(fm.form);
	        }   
	    }, {
	    	text : 'Cancle',
			handler :function(){
				rfw.close();
			} 
	    }] 
    }, config || {}));
};

Ext.extend(DC.front.win.RenameFileWin, Ext.Window, {
	doRename : function(form) {
		var win = this;
		if(form.isValid()){  
        	DC.util.CommonAction.loadMask("Rename...");
        	var value = Ext.getCmp('rename_file_win_newName_textfiled').getValue();
            //form提交  
	        form.submit({
	        	url: DC.url.RENAME_FILE, 
                method: 'post',  
                //处理ajax的返回数据  
                success: function(form, action){
                	win.close();
                	DC.util.CommonAction.unMask();
                	DC.obj.explorer_treePanel.getSelectionModel()
            				.getSelectedNode().setText(value);
                 },  
                 failure : function(form, action){
                 	 var res = action.result;
                     switch (action.failureType) {
     	                case Ext.form.Action.CLIENT_INVALID: // 当客户端验证失败时执行
     	                     break;
     	                case Ext.form.Action.CONNECT_FAILURE:
     	                	 Ext.example.msg('Prompt', 'Network connection failure, so fail to commit.', res.type);
     	                     break;
     	                case Ext.form.Action.SERVER_INVALID: // 当服务器端的success属性的值返回false时执行
     	                	Ext.example.msg('Prompt', res.msg, res.type);
     	            }
                    DC.util.CommonAction.unMask();
                 }   
	        });  
        } 
	}
});